const baseURL = 'http://localhost:3000';

//获取id
console.log(this.location.search.slice(4));
console.log(typeof this.location.search);
const id = this.location.search.slice(4);
// const id = this.id;
//发送异步请求
$.ajax({
  url: `${baseURL}/blogs/` + id,
  type: 'GET',
  success: function (res) {
    console.log(res);

    const div = `
      <h1 class="title">${res.result.title}</h1>
      <div class="author">作者:${res.result.author}分类:${res.result.category_name} 创建时间:${res.result.updatetime} </div>
      <hr>
      <div class="content"><p>${res.result.content}</P></div>`;
    $('.theBlog').append(div);
  },
});
